efform_onload = function ()
{
	$('#flag').val()==1;
};  

button_query_onclick = function (){
	efgrid.submitInqu( "ef_grid_result", "ZM","ZMCG91","query");
}

button_insert_onclick = function (){
	date();
	if (isSelected("ef_grid_result") == 0)return; 
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG91","insert",true); 
}

button_update_onclick = function (){  
	date();
	if (isSelected("ef_grid_result") == 0)return; 
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG91","update",true);
}

button_delete_onclick = function() {
	if (isSelected("ef_grid_result") == 0)return;
	EFConfirm('你确认要删除吗?', '确认框',function(r) {
				if (r)efgrid.submitForm("ef_grid_result", "ZM", "ZMCG91","delete", true);
	});
}

date = function()
{
	var now = new Date();
    var year = now.getFullYear();       //年
    var month = now.getMonth() + 1;     //月
    var day = now.getDate();            //日 
    var clock = year + "-";
    if(month < 10) clock += "0";
    clock += month + "-";
    if(day < 10) clock += "0";
    clock += day + " "; 
    var date = clock;
    
    var grid=isSelected("ef_grid_result");
	if (grid == 0)return; 
	var rows=grid.getCheckedRows();
	for(var i=0;i<rows.length;i++)
	{
		var fdVirtualDate = grid.getCellValueByColumnName(rows[i],"fdVirtualDate");
		if(fdVirtualDate < date)
		{
			EFAlert("调度日期晚于当前日期"); return;
		}
	}
}